<template>
  <div id="app">
      <router-view/>
  </div>
</template>

<script>
export default {
    mounted() {
        this.getNotice()
    },
    methods: {
        // 获取公告
        getNotice() {
            this.$get('notice/getNotice')
                .then((res) => {
                    let { code, data } = res.data
                    if (code === 0) {
                        this.$createDialog({
                            type: 'confirm',
                            title: '公告',
                            showClose: true,
                            content: data,
                            confirmBtn: {
                                text: '确认已读'
                            },
                            cancelBtn: {
                                text: '关闭'
                            },
                            onConfirm: () => {
                                // 已读公告
                                this.$post('notice/read')
                            }
                        }).show()
                    }
                })
        }
    }
}
</script>

<style lang="stylus">
body,html
  height 100%
#app
  font-family Avenir, Helvetica, Arial, sans-serif
  -webkit-font-smoothing antialiased
  -moz-osx-font-smoothing grayscale
  height 100%
  background #f2f2f2
  font-size 14px
</style>
